package com.wjw.java.oop.polymorphic_.demo;

/**
 * 父类：Animal
 * 子类：Dog、Cat
 */
public class Animal {

    String name;

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

//    public Animal() {
//
//    }

    public Animal(String name) {
        this.name = name;
    }
}
//狗：子类
class Dog extends Animal {

    public Dog(String name) {
        super(name);
    }
}
//猫：子类
class Cat extends Animal {

    public Cat(String name) {
        super(name);
    }
}
